From: Andrew Cooper Date: Thu, 14 May 2015 08:55:03 +0000 (+0800) Subject: libxc/migration: Be rather stricter with illformed callers X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~3251 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=6abbcd3e380c3c829cf366ff2c0669226356b777;p=xen.git libxc/migration: Be rather stricter with illformed callers The migration code itself should be able to validly assume all mandatory callbacks are set up. Signed-off-by: Andrew Cooper CC: Ian Campbell CC: Ian Jackson CC: Wei Liu CC: Yang Hongyang Acked-by: Ian Campbell --- diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xc_sr_save.c index 5d9c267182..83f059190b 100644 --- a/tools/libxc/xc_sr_save.c +++ b/tools/libxc/xc_sr_save.c @@ -738,6 +738,10 @@ int xc_domain_save2(xc_interface *xch, int io_fd, uint32_t dom, ctx.save.max_iterations = 5; ctx.save.dirty_threshold = 50; + /* Sanity checks for callbacks. */ + if ( hvm ) + assert(callbacks->switch_qemu_logdirty); + IPRINTF("In experimental %s", __func__); DPRINTF("fd %d, dom %u, max_iters %u, max_factor %u, flags %u, hvm %d", io_fd, dom, max_iters, max_factor, flags, hvm); diff --git a/tools/libxc/xc_sr_save_x86_hvm.c b/tools/libxc/xc_sr_save_x86_hvm.c index 8baa1049e9..58efdb9fe9 100644 --- a/tools/libxc/xc_sr_save_x86_hvm.c +++ b/tools/libxc/xc_sr_save_x86_hvm.c @@ -166,13 +166,6 @@ static int x86_hvm_setup(struct xc_sr_context *ctx) { xc_interface *xch = ctx->xch; - if ( !ctx->save.callbacks->switch_qemu_logdirty ) - { - ERROR("No switch_qemu_logdirty callback provided"); - errno = EINVAL; - return -1; - } - if ( ctx->save.callbacks->switch_qemu_logdirty( ctx->domid, 1, ctx->save.callbacks->data) ) {